﻿//////////////////////////////////////////////////////////////////////////////////
//
// Project            : XNAsteroids
// Module             : XNAsteroidsGameObjects
// Description        : Colored space object.
// 
// Repository         : $URL$
// Last changed by    : $LastChangedBy$
// Revision           : $LastChangedRevision$
// Last Changed       : $LastChangedDate$
// Author             : $Author$
//
// Id                 : $Id$
//
// Copyright          : (c) 2010 Torsten Bär
//
// Published under the MIT License. See license.txt or http://www.opensource.org/licenses/mit-license.php.
//
//////////////////////////////////////////////////////////////////////////////////

using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace XNAsteroids.GameObjects.SpaceObjects
{
   /// <summary>
   /// Colored space object.
   /// </summary>
   public abstract class ColoredSpaceObject: SpaceObject
   {
      #region Fields

      private VertexDeclaration vertexDeclaration;

      #endregion

      #region Properties

      /// <summary>
      /// Gets the vertex declaration.
      /// </summary>
      protected override VertexDeclaration VertexDeclaration
      {
         get
         {
            if (vertexDeclaration == null)
               vertexDeclaration = new VertexDeclaration(GraphicsDevice, VertexPositionColor.VertexElements);
            return vertexDeclaration;
         }
      }

      #endregion

      #region Constructors

      /// <summary>
      /// Initializes a new instance of the <see cref="ColoredSpaceObject"/> class.
      /// </summary>
      /// <param name="game">The game.</param>
      /// <param name="position">The position.</param>
      /// <param name="effect">The effect.</param>
      protected ColoredSpaceObject(Game game, Vector3 position, BasicEffect effect)
         : base(game, position, effect)
      {
         effect.TextureEnabled = false;
         effect.VertexColorEnabled = true;
      }

      #endregion
   }
}
